package com.example.project.common.advice;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.AsyncHandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.net.URISyntaxException;
import java.util.Objects;

/**
 * @author: Jerry.Zhang
 * @date: 2022/3/18 10:52
 */
@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    private final AsyncHandlerInterceptor asyncHandlerInterceptor;

    public WebConfigurer(AsyncHandlerInterceptor asyncHandlerInterceptor) {
        this.asyncHandlerInterceptor = asyncHandlerInterceptor;
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //配置server虚拟路径，handler为jsp中访问的目录，locations为files相对应的本地路径
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(asyncHandlerInterceptor);
        WebMvcConfigurer.super.addInterceptors(registry);
    }

}
